// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#pragma once

#include <pollux/common/caching/scan_tracker.h>

namespace kumo::pollux::cache {
    // Dummy implementation of SsdCache admission stats.
    class FileGroupStats {
    public:
        // Records ScanTracker::recordReference at group level
        void recordReference(
            uint64_t /*fileId*/,
            uint64_t /*groupId*/,
            TrackingId /*trackingId*/,
            int32_t /*bytes*/) {
        }

        // Records ScanTracker::recordRead at group level
        void recordRead(
            uint64_t /*fileId*/,
            uint64_t /*groupId*/,
            TrackingId /*trackingId*/,
            int32_t /*bytes*/) {
        }

        // Records the existence of a distinct file inside 'groupId'
        void recordFile(
            uint64_t /*fileId*/,
            uint64_t /*groupId*/,
            int32_t /*numStripes*/) {
        }

        // Returns true if groupId, trackingId qualify the data to be cached to SSD.
        bool shouldSaveToSsd(uint64_t /*groupId*/, TrackingId /*trackingId*/) const {
            return true;
        }

        // Updates the SSD selection criteria. 'ssdsize' is the capacity,
        // 'decayPct' gives by how much old accesses are discounted.
        void updateSsdFilter(uint64_t /*ssdSize*/, int32_t /*decayPct*/  = 0) {
        }

        // Recalculates the best groups and makes a human readable
        // summary. 'cacheBytes' is used to compute what fraction of the tracked
        // working set can be cached in 'cacheBytes'.
        std::string toString(uint64_t /*cacheBytes*/) {
            return "<dummy FileGroupStats>";
        }
    };
} // namespace kumo::pollux::cache
